﻿#region
/*******************************************************************************
** File Name:		    AreaRepository.cs
** Creator:		        chao.jiang 
** EMail:               chao.jiang 
** Create date:	        
** Latest Modifier:
** Latest Modify date:
** Description:		    
** Modify History:
**
** Code Review:
**
** Version number:       1.0.0
*********************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using Phoenix.Entity;
using Phoenix.Respository;
using IBatisNet.DataMapper;
using Phoenix.Data.IBatis;

namespace Phoenix.IBatisRepository
{
    public class AreaRepository : BaseIBatisDao,IArea
    {

        #region  Auto Generation

        public AreaRepository()
            : base("/Config/IBatis/86TCMap.Config")
        {

        }

        public void AddArea(EArea entity)
        {
            string stmtId = "AreaMap.InsertArea";
            base.SqlMapper.Insert(stmtId, entity);
        }

        public EArea GetByAreaID(System.Int32 areaID)
        {
            string stmtId = "AreaMap.SelectByAreaID";
            return base.SqlMapper.QueryForObject<EArea>(stmtId, areaID);
        }

        public void DeleteByAreaID(System.Int32 areaID)
        {
            string stmtId = "AreaMap.DeleteByAreaID";
            base.SqlMapper.Update(stmtId, areaID);
        }

        public void UpdateByAreaID(EArea entity)
        {
            string stmtId = "AreaMap.UpdateByAreaID";
            base.SqlMapper.Update(stmtId, entity);
        }


        public IList<EArea> GetAll()
        {
            string stmtId = "AreaMap.SelectAll";
            return base.SqlMapper.QueryForList<EArea>(stmtId, null);
        }

        #endregion

        public IList<EArea> GetAllProvince()
        {
            string stmtId = "AreaMap.SelectAllProvince";
            return base.SqlMapper.QueryForList<EArea>(stmtId, null);

        }

        public IList<EArea> GetByParentID(int ParentId)
        {
            string stmtId = "AreaMap.SelectByParentID";
            return base.SqlMapper.QueryForList<EArea>(stmtId, ParentId);

        }


        
    }
}

